<!--
Title: Contace Us
Filename: contact.html
Author: Justin Cronk
Date: Oct 28, 2012

A list of contacts.
-->
<?php
	$pageTitle = "Contact Us";
 
	include("gpagetop.php");
?>
<br /><br />
<?php

   $dbh = mysql_connect("localhost","root","root") or die("cannot connect");
   mysql_select_db("travelexperts");

   



$result = mysql_query ("SELECT `AgncyAddress`,`AgncyCity`,`AgncyProv`,`AgncyPostal`, `AgncyPhone`, `AgncyFax` FROM agencies WHERE(`agencies`.`AgencyId` = 1) "); 

while ($row = mysql_fetch_array($result)) 
{ 
$AgncyAddress= $row["AgncyAddress"]; 
$AgncyCity= $row["AgncyCity"]; 
$AgncyProv= $row["AgncyProv"]; 
$AgncyPostal= $row["AgncyPostal"];
$AgncyPhone= $row["AgncyPhone"];
$AgncyFax= $row["AgncyFax"]; 
}

   print ("<table style = \"margin:auto; vertical-align:center;\">");
   print ("<tr><th style = 'text-align:left;'>Office</th><th style = 'text-align:center;'>Contacts</th></tr>");
   print("<tr><td style = 'height:50px;'></td></tr>");
   print ("<tr><td style = 'text-align:top; width:200px;'>
				<strong>Calgary Office</strong><br />
				$AgncyAddress<br />
				$AgncyCity, $AgncyProv $AgncyPostal<br />
				 Phone: $AgncyPhone<br />
				 Fax:   $AgncyFax</td>");
   print ("<td>");
   $result1 = mysql_query("SELECT `AgtFirstName`,`AgtLastName`,`AgtBusPhone`,`AgtEmail` FROM agents WHERE(`agents`.`AgencyId` = 1) ");
   print("<table>");
   $firstrow = true;
   $i = "0";
   while ($row = mysql_fetch_assoc($result1))
   {
      if ($firstrow)
	  {
	     //print column headings
	     print("<tr>");
		 print("<th colspan='2' style='text-align:left;width:150px;'>Name</th><th style='text-align:left;width:150;'>Phone Number</th><th style = 'text-align:left;'>Email</th>");
	     print("</tr>");
		 $firstrow = false;
	  }
	  
	  print("<tr>");
	    
		
	  foreach ($row as $col)
	  {
		if($i < 4 )
			{print("<td style=\"background-color:SkyBlue;\">$col</td>");}
		else
	        {print("<td>$col</td>");}
		    if ($i == 7)
			 {$i = 0;}
			else
		     {$i++;}
	  }
	  print("</tr>");
   }
   
$result = mysql_query ("SELECT `AgncyAddress`,`AgncyCity`,`AgncyProv`,`AgncyPostal`, `AgncyPhone`, `AgncyFax` FROM agencies WHERE(`agencies`.`AgencyId` = 2) "); 

while ($row = mysql_fetch_array($result)) 
{ 
$AgncyAddress= $row["AgncyAddress"]; 
$AgncyCity= $row["AgncyCity"]; 
$AgncyProv= $row["AgncyProv"]; 
$AgncyPostal= $row["AgncyPostal"];
$AgncyPhone= $row["AgncyPhone"];
$AgncyFax= $row["AgncyFax"]; 
}
   print("</table>");
   print("</td></tr>");
   print("<tr><td style = 'height:50px;'></td></tr>");
   print ("<tr><td style = 'text-align:top; width:200px;'>
				<strong>Okotoks Office</strong><br />
				$AgncyAddress<br />
				$AgncyCity, $AgncyProv $AgncyPostal<br />
				 Phone: $AgncyPhone<br />
				 Fax:   $AgncyFax</td>");
   print ("<td>");
   $result2 = mysql_query("SELECT `AgtFirstName`,`AgtLastName`,`AgtBusPhone`,`AgtEmail` FROM agents WHERE(`agents`.`AgencyId` = 2) ");
   print("<table>");
   $firstrow = true;
   $i="0";
   while ($row = mysql_fetch_assoc($result2))
   {
      if ($firstrow)
	  {
	     //print column headings
	     print("<tr>");
		 print("<th colspan='2' style='text-align:left;width:150px;'>Name</th><th style='text-align:left;width:150;'>Phone Number</th><th style = 'text-align:left;'>Email</th>");
	     print("</tr>");
		 $firstrow = false;
	  }
	  
	  print("<tr>");
	  foreach ($row as $col)
	  {
		if($i < 4 )
		 {print("<td style=\"background-color:SkyBlue;\">$col</td>");}
		else
		 {print("<td>$col</td>");}
		 if ($i == 7)
			 {$i = 0;}
		 else
			 {$i++;}
	   }
	  print("</tr>");
   }
   print("</table>");   
   print("</td></tr></table>");
  
   mysql_close($dbh);
?>
	
<?php
	include("gpagebottom.php");
?>